package ae.pcfc.etks.online.itworx.ehs.web.facade;

import java.util.Date;
import java.util.List;

import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCRequest;
import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCRequestHistory;
import ae.pcfc.etks.online.itworx.ehs.web.entity.Request;
import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestAction;
import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestStatus;
import ae.pcfc.etks.online.itworx.ehs.web.exception.CommunicationException;
import ae.pcfc.etks.online.itworx.ehs.web.exception.FNPServiceExpcetion;
import ae.pcfc.etks.online.itworx.ehs.web.exception.IMSException;
import ae.pcfc.etks.online.itworx.ehs.web.exception.InvalidInputException;
import ae.pcfc.etks.online.itworx.ehs.web.exception.WorkFlowException;
import ae.pcfc.etks.online.itworx.ehs.web.model.RequestSearchCriteria;


public interface WorkflowFacade extends Facade {

	/*List<Request> getAllRequests(String userId, String companyName,
			UserType user, Date creationDateFrom, Date creationDateTo,
			RequestStatus requestStatus, RequestField sortField,
			boolean ascending, int pageNo);*/
	
	List<OFCRequest> getAllRequestsByStatus(List<RequestStatus>  requestsStatus);

	OFCRequest getRequestDetails(Long requestId,String userId, boolean isOfficer)throws InvalidInputException, CommunicationException;

	List<OFCRequestHistory> getRequestHistory(Long requestId);

	void createOFCRequest(OFCRequest ofcRequest) throws InvalidInputException,
	CommunicationException;
	
	void updateOFCRequest(OFCRequest ofcRequest);

	boolean isOfficer(String username) throws CommunicationException;
	
	void doRequestAction(Long requestId,String doAction ,String userName,RequestAction actionType, boolean isOfficer)throws CommunicationException, InvalidInputException;
	
	List<Request> getAllRequests(String userName,boolean isOffecier,RequestSearchCriteria criteria)throws InvalidInputException, CommunicationException, RuntimeException;
	
	List<Request> getActiveTasks(RequestSearchCriteria criteria,String processName, String userName, boolean isOffecier, boolean isAssigned) throws CommunicationException, InvalidInputException;
	
	long getAllRequestsSize(String userName, boolean isOfficer,RequestSearchCriteria searchCriteria)throws CommunicationException, InvalidInputException;
	
	long getAllActiveTasksSize(String processName,String userName, boolean isOfficer,RequestSearchCriteria searchCriteria, boolean isAssigned)throws CommunicationException, InvalidInputException;
	
	void cancelRequest(long requestId, String username, boolean isOfficer) throws CommunicationException, InvalidInputException,FNPServiceExpcetion,IMSException;
	
	void closeRequest(long requestId, String username, boolean isOfficer) throws CommunicationException, InvalidInputException,FNPServiceExpcetion,IMSException;
	
	boolean manipulateRequest(OFCRequest ofcRequest,String userName,boolean isOfficer,RequestAction action) throws CommunicationException,WorkFlowException,InvalidInputException;
	
	int createOFCProcess(OFCRequest ofcRequest) throws InvalidInputException, CommunicationException;
	
	boolean sendK2Mail(String processId, String username, String actionType, OFCRequest ofcRequest, boolean isOfficer) throws WorkFlowException;

	boolean manipulateIMSRequest(OFCRequest ofcRequest, String userName,	boolean isOfficer, RequestAction action,String imsStatus, Date processingDate) throws WorkFlowException,RuntimeException;

	long getActiveRequestSize(String userName);
}
